﻿' Frowser - http://www.frowser.net
' Copyright (c) 2010
' by Will Morgenweck, Active Modules, Inc.
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.ApplicationBlocks.Data
Imports System.Configuration

Namespace Frowser
    Public Class Data
#Region "Private Members"
        Private _providerConfiguration As DotNetNuke.Framework.Providers.ProviderConfiguration = DotNetNuke.Framework.Providers.ProviderConfiguration.GetProviderConfiguration("data")
        Friend connectionString As String
        Friend objectQualifier As String
        Friend databaseOwner As String
        Friend databaseObjectPrefix As String = "activeforums_"
        Friend dbPrefix As String
#End Region
#Region "Constructors"
        Public Sub New()
            connectionString = ConfigurationManager.ConnectionStrings("SiteSqlServer").ConnectionString
            Dim objProvider As DotNetNuke.Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), DotNetNuke.Framework.Providers.Provider)

            objectQualifier = objProvider.Attributes("objectQualifier")
            If objectQualifier <> "" And objectQualifier.EndsWith("_") = False Then
                objectQualifier += "_"
            End If

            databaseOwner = objProvider.Attributes("databaseOwner")
            If databaseOwner <> "" And databaseOwner.EndsWith(".") = False Then
                databaseOwner += "."
            End If
            dbPrefix = databaseOwner & objectQualifier & databaseObjectPrefix
        End Sub
#End Region
#Region "Public Members"
       
        
#End Region
    End Class
End Namespace

